/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.games.esmi.ieat.indicatorrelations;

import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import eu.games.esmi.ieat.indicatorrelations.data.Correlation;

/**
 *
 * @author user
 */
public class CorrelationAnalysisTab extends Panel {
    
    private Table table = new Table();
    
    public CorrelationAnalysisTab() {
        super();
        init();
    }
    
    public void init() {
        
        //VerticalLayout vl = new VerticalLayout();
        //vl.setSpacing(true);
        
        //vl.addComponent(new Label("Indicators"));
        this.addComponent(new Label("Defined correlations"));
        

        final BeanItemContainer<Correlation> tableContainer = new BeanItemContainer<Correlation>(Correlation.class);
        table.setContainerDataSource(tableContainer);
        table.setVisibleColumns(new Object[] { "label", "value" });
        
        //TODO PROVA!!!
        //table.addItem(new Correlation("CPU usage s1 > CPU usage s2", "0,43"));
        //table.addItem(new Correlation("CPU usage s1 > Response Time s2", "n.d."));
        //Tabs.INSTANCE.correlationAnalysisTab = this;
        
        this.addComponent(table);
        //vl.addComponent(table);

        //vl.addComponent(new IndicatorChart());
        
        //this.addComponent(vl);
    }
    
    public void addCorrelationToTable(Correlation row) {
        table.addItem(row);
    }
    
    public void clearCorrelationTable() {
        table.removeAllItems();
    }
        
}
